# Maintainer: David Runge <dvzrv@archlinux.org>

_name=pymediainfo
pkgname=python-pymediainfo
pkgver=6.0.1
pkgrel=2
pkgdesc="A Python wrapper around the MediaInfo library"
arch=(any)
url="https://github.com/sbraz/pymediainfo/"
license=(MIT)
depends=(libmediainfo python)
makedepends=(mediainfo python-build python-installer python-setuptools python-setuptools-scm python-wheel)
checkdepends=(python-pytest python-pytest-runner)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('7b373b133911eb320248f72627f6aeb6fa04705b55500639d18094ed8227296fd744c2c4b76d765e8b2d98d78f443114e9ca7ef8e2e0eb498d48d2b46956f952')
b2sums=('402c71157e43fd03efe37934932c61e1e22d469c13f5b5e85d7e0f1d52d6e54289860777c1677efeb4710a5c55086a1c7db03da8ad2f88f49d144bd5484f8638')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build:$PYTHONPATH"
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 {AUTHORS,README.rst} -t "$pkgdir/usr/share/doc/$pkgname/"
}
